package com.base;

/**
 * Created by yijy on 2018/3/8.
 */
public class StackApp {
    private long[] stack;
    private int top;
    private int maxSize;

    public StackApp(int size) {
        maxSize = size;
        stack = new long[maxSize];
        this.top = -1;
    }

    public void push(int value){
        stack[++top] = value;
    }

    public long pop(){
        return stack[top--];
    }

    public long peek(){
        return stack[top];
    }

    public boolean isEmpty(){
        return top == -1;
    }

    public boolean isFull(){
        return top == (maxSize-1);
    }
}
